<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增工人工日单价')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-history-add">
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">工日单价类型：</label>
                <div class="col-sm-8">
                    <select name="priceType" class="form-control m-b" th:with="type=${@dict.getType('history_price_type')}" required>
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">国别：</label>
                <div class="col-sm-8">
                    <select name="countryType" class="form-control m-b" th:with="type=${@dict.getType('country_list')}" required>
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">年份：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <input name="year" class="form-control" placeholder="yyyy" type="text" required>
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">货币类型：</label>
                <div class="col-sm-8">
                    <select name="currencyType" class="form-control m-b" th:with="type=${@dict.getType('currency_type')}" required>
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">单价：</label>
                <div class="col-sm-8">
                    <input name="priceVal" class="form-control" type="text"  required>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">备注：</label>
                <div class="col-sm-8">
                    <textarea name="remark" class="form-control"></textarea>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <script th:inline="javascript">
        var prefix = ctx + "system/history"
        $("#form-history-add").validate({
            focusCleanup: true,
            rules : {
                priceVal : {
                    isNumber : true
                }
            }
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/add", $('#form-history-add').serialize());
            }
        }

        $("input[name='year']").datetimepicker({
            format: "yyyy",
            startView: 'decade',
            minView:'decade',
            maxView:'decade',
            autoclose: true
        });
    </script>
</body>
</html>